package com.guchenbo.study.aop;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/3")
public class IndexController3 {

    @Resource
    private TxServiceA txServiceA;
    @Resource
    private UserService userService;

    @GetMapping("/1")
    public String t1() {
        userService.user();
        try {
            userService.error();
        } catch (Exception e) {
            e.printStackTrace();
        }
        txServiceA.nestTx(true,true);
        return "ok";
    }
    @GetMapping("/2")
    public String t2() {        txServiceA.nestTx(true,false);

        return "ok";
    } @GetMapping("/3")
    public String t3() {        txServiceA.nestTx(false,false);

        return "ok";
    } @GetMapping("/4")
    public String t4() {        txServiceA.nestTx(false,true);

        return "ok";
    }
}
